import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'parseJson'
})
export class ParseJsonPipe implements PipeTransform {

  transform(value: any, args?: any): any {

    const content = JSON.parse(value);

    if (args) {
        return content[args];
    } else {
        return content;
    }
  }

}
